package org.happycomp.radio.planner;

import java.util.Date;
import java.util.concurrent.locks.Lock;

import org.happycomp.radio.Station;
import org.happycomp.radio.StopDownloadCondition;

/**
 * Planovac
 * @author pavels
 */
public interface Planner {
	
	/**
	 * Synchronizacni zamek
	 * @return
	 */
	Lock getPlannerLock();
	
	/**
	 * Naplanuje novou ulohu 
	 * @param station Stanice
	 * @param condition Podminka ukonceni 
	 * @param title Titulek
	 * @param plannedDate Zacatek
	 * @return
	 */
	PlannedItem plan(Station station, StopDownloadCondition condition, String title, Date plannedDate);
	
	/**
	 * Vraci vsechny naplanovane ulohy
	 * @return
	 */
	PlannedItem[] getPlannedItems();

	/**
	 * Zrusi naplanovanou ulohu
	 * @param plannedItem
	 */
	void removePlannedItem(PlannedItem plannedItem);
	
	/**
	 * Odebere naplanovanou ulohu, ktera je uz "zrala" na nahravani
	 * @return
	 */
	PlannedItem popNext();

	/**
	 * Vraci naposledy odebranou naplanovanou ulohu
	 * @return
	 */
	PlannedItem getJustPopped();
	
}
